// 2025/11/20
// 寻找旋转排序数组中的最小值

class Solution {
public:
    int findMin(vector<int>& nums) {
        int n = nums.size();
        int l = 0, r = n - 1, begin = 0;
        while(l <= r)
        {
            int mid = (l + r) >> 1;
            if(nums[mid] <= nums.back())
            {
                begin = mid;
                r = mid - 1;
            }
            else
                l = mid + 1;
        }
        return nums[begin];
    }
};